package net.googlecode.morenko.task3;

/**
 * The parent class for all kinds of workers, such as Employee, Manager, Director.
 */
public class Worker {
    private String firstName;
    private String lastName;
    private int age;
    private long rate;
    private boolean perHour;
    private boolean bonus;
    private long bonusAmT;
    private int tax;

    /**
     * Constructor, creates object.
     * @param firstName objects first name.
     * @param lastName  objects second name.
     */
    public Worker(String firstName, String lastName) {
        this.firstName = firstName;
        this.lastName = lastName;
    }

    /**
     * Set the age value.
     * @param age the age value.
     */
    public void setAge(int age) {
        this.age = (age > 0) ? age : 0;
    }

    /**
     * Set the rate value.
     * @param rate the rate value.
     */
    public void setRate(long rate) {
        this.rate = (rate > 0) ? rate : 0;
    }

    /**
     * Set is the person has per hour rate.
     * @param perHour true or false.
     */
    public void setPerHour(boolean perHour) {
        this.perHour = perHour;
    }

    /**
     * Set is the person has bonus.
     * @param bonus true or false.
     */
    public void setBonus(boolean bonus) {
        this.bonus = bonus;
    }

    /**
     * Set the bonus value.
     * @param bonusAmT the value of bonus.
     */
    public void setBonusAmT(long bonusAmT) {
        this.bonusAmT = (bonusAmT > 0) ? bonusAmT : 0;
    }

    /**
     * Set the tax value.
     * @param tax tax value.
     */
    public void setTax(int tax) {
        this.tax = (tax > 0) ? tax : 0;
    }

    /**
     * Get the age of the person.
     * @return persons age.
     */
    public int getAge() {
        return this.age;
    }

    /**
     * Get the rate of the person.
     * @return persons rate.
     */
    public long getRate() {
        return this.rate;
    }

    /**
     * Check is the person has per hour rate.
     * @return true or false.
     */
    public boolean getPerHour() {
        return this.perHour;
    }

    /**
     * Check is the person has bonus.
     * @return true or false.
     */
    public boolean getBonus() {
        return this.bonus;
    }

    /**
     * Get bonus amount value.
     * @return bonus amount.
     */
    public long getBonusAmT() {
        return this.bonusAmT;
    }

    /**
     * Get the tax value.
     * @return tax value.
     */
    public int getTax() {
        return this.tax;
    }

    /**
     * Get the first name and last name of the person.
     * @return first name and last name.
     */
    public String getName() {
        return firstName + " " + lastName;
    }
}
